package javaExecute;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Connectar{
	
	private static Connection con;
	
	public Connectar(){}
	
	public Connection pegarConexao(){
		
		 try {  
			 Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");  
			 String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
					   "databaseName=ProjetoIntegrado;user=sa;password=conectar";
					Connection con = DriverManager.getConnection(connectionUrl); 
	            System.out.println("Conexao ok");  
	              
	        } catch (ClassNotFoundException e) {  
	            e.printStackTrace();  
	        } catch (SQLException e) {  
	            e.printStackTrace();  
	        } catch (Exception e) {  
	            e.printStackTrace();  
	        }  
	  
	        return con;  
		
	}
	
	public void fecharConexao(){
		
	}
	
}
